package org.example.greenhouse.controller;

import io.swagger.annotations.ApiOperation;
import org.example.greenhouse.result.Result;
import org.example.greenhouse.service.CameraService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;


@CrossOrigin
@RestController
@Api (tags="监控数据")
@RequestMapping("/Camera")
public class CameraController {

    @Autowired
    private CameraService cameraService;

//    更新监控图片
    @PostMapping("/update")
    @ApiOperation("获取最新的监控照片")
    public Result updataCameraData() {
        return  cameraService.updataCameraData();
    }

    @GetMapping("/all")
    @ApiOperation("获取所有监控数据")
    public Result getAllCameraData() {
        return cameraService.getAllCameraData();
    }
    // 获取监控 Token
    @GetMapping("/getToken")
    @ApiOperation("获取监控 Token")
    public Result getAccessToken() {
        return cameraService.getAccessToken();
    }
    // 获取监控设备数据
    @GetMapping("/getDevices")
    @ApiOperation("获取所有监控设备数据")
    public Result getCameraDevices() {
        return cameraService.getCameraDevices();
    }

}